package com.coffee.netty.connection;


import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author songkui
 * @since 2024/7/31
 */
public enum OnlineType {
    Unbound(0),
    Online(1),
    Disconnect(-1),
    OffLine(-9)
            ;
    private final int value;

    OnlineType(int value) {
        this.value = value;
    }

    private final static Map<Integer, OnlineType> stateMap  = Arrays.stream(OnlineType.values()).collect(Collectors.toMap(OnlineType::value, t -> t));


    public int value() {
        return this.value;
    }

    public static OnlineType valueOf(int value) {
        return stateMap.get(value);
    }

}
